package com.codeplay.security.config;

import com.codeplay.security.filter.JwtAuthenticationFilter;
import com.codeplay.security.service.JwtService;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import lombok.RequiredArgsConstructor;

@Data
@Configuration
@ConfigurationProperties(prefix = "application.security.jwt")
@RequiredArgsConstructor
public class JwtConfig {
    private String secretKey;
    private long expiration;
    private RefreshToken refreshToken;

    private final JwtService jwtService;

    @Data
    public static class RefreshToken {
        private long expiration;
    }

    @Bean
    public JwtAuthenticationFilter jwtAuthFilter() {
        return new JwtAuthenticationFilter(jwtService);
    }
} 